﻿Imports BusinessLogicLayer
Imports BE = BusinessEntities
Partial Class PopUpRendiciones
    Inherits System.Web.UI.Page
    Dim str_error As String

    Dim str_parametro As String
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        str_parametro = Request.QueryString("par")
        Dim bean As New BE.RendicionDTO
        bean.Codigo_Rendicion = str_parametro

        If Not Page.IsPostBack Then
            CargarRendiciones(bean)
            CargarRendiciones_detalle(bean)

        End If

    End Sub

    Sub CargarRendiciones(ByVal bean As BE.RendicionDTO)

        Dim capanegocios As New RendicionesBL
        Try
            gvdRequisicion.DataSource = capanegocios.Listar_Buscar_Rendicion(bean)
            gvdRequisicion.DataBind()

        Catch ex As Exception
            str_error = capanegocios.CapturaError

            Response.Redirect("Errores.aspx?par=" & str_error)
        Finally

            capanegocios = Nothing

        End Try
    End Sub

    Sub CargarRendiciones_detalle(ByVal bean As BE.RendicionDTO)

        Dim capanegocios As New RendicionesBL
        Try
            gvdRendicion_detalle.DataSource = capanegocios.Listar_Buscar_Rendicion_detalle(bean)
            gvdRendicion_detalle.DataBind()

        Catch ex As Exception
            str_error = capanegocios.CapturaError

            Response.Redirect("Errores.aspx?par=" & str_error)
        Finally

            capanegocios = Nothing

        End Try
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Response.Redirect("buscarRendicion.aspx")

    End Sub
End Class
